<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>新增App基础信息页</title>
    <%@ include file="/basePath.jsp" %>
    <meta name="viewport" content="width=device-width,initial-scale=1,shrink-to-fit=no"/>
    <link rel="stylesheet" href="statics/bootstrap/css/bootstrap.css">
</head>
<body>
<script src="statics/js/jquery-3.6.0.js"></script>
<script src="statics/bootstrap/js/bootstrap.js"></script>
<script>
    $(function () {
        $("#categoryLevel1").change(function () {
            $("#categoryLevel2").empty();
            $("#categoryLevel3").empty();
            var fid = $("#categoryLevel1").val();
            $.getJSON("secondLevel/" + fid, function (result) {
                $("<option>").attr("hidden", true).append("请选择").appendTo($("#categoryLevel2"))
                $.each(result.extend.secondLevels, function () {
                    var options = $("<option>").val(this.id).append(this.name);
                    options.appendTo($("#categoryLevel2"));
                })
            })
        })
        $("#categoryLevel2").change(function () {
            $("#categoryLevel3").empty();
            var sid = $("#categoryLevel2").val();
            $.getJSON("thirdLevel/" + sid, function (result) {
                $("<option>").attr("hidden", true).append("请选择").appendTo($("#categoryLevel3"))
                $.each(result.extend.thirdLevels, function () {
                    var options = $("<option>").val(this.id).append(this.name);
                    options.appendTo($("#categoryLevel3"));
                })
            })
        })
    })
</script>
<div class="container-fluid" style="min-width: 1000px;">
    <div id="header" class="p-3 border">
        <h1 style="font-size: 18px;">新增App基础信息<small class="ml-3 text-danger">用户：${devName}</small>
        </h1>
    </div>
    <div class="p-3 border">
        <form class="w-75 m-auto" action="appInfo/${devId}" method="post" enctype="multipart/form-data">
            <div class="">
                <div class="form-group form-row">
                    <label for="softwareName" class="col-3">软件名称:</label>
                    <input type="text" class="form-control col-5" id="softwareName" name="softwareName">
                    <span class="col-4">error</span>
                </div>
                <div class="form-group form-row">
                    <label for="apkName" class="col-3">APK名称:</label>
                    <input type="text" class="form-control col-5" id="apkName" name="apkName">
                    <span class="col-4">error</span>
                </div>
                <div class="form-group form-row">
                    <label for="supportRom" class="col-3">支持ROM:</label>
                    <input type="text" class="form-control col-5" id="supportRom" name="supportRom">
                    <span class="col-4">error</span>
                </div>
                <div class="form-group form-row">
                    <label for="interfaceLanguage" class="col-3">界面语言:</label>
                    <input type="text" class="form-control col-5" id="interfaceLanguage" name="interfaceLanguage">
                    <span class="col-4">error</span>
                </div>
                <div class="form-group form-row">
                    <label for="sofewareSize" class="col-3">软件大小:</label>
                    <input type="text" class="form-control col-5" id="sofewareSize" name="sofewareSize">
                    <span class="col-4">error</span>
                </div>
                <div class="form-group form-row">
                    <label for="downloads" class="col-3">下载次数:</label>
                    <input type="text" class="form-control col-5" id="downloads" name="downloads">
                    <span class="col-4">error</span>
                </div>
                <div class="form-group form-row ">
                    <label for="flatformId" class="col-3">所属平台:</label>
                    <select id="flatformId" name="flatformId" class="form-control col-5">
                        <option selected hidden>请选择</option>
                        <c:forEach var="item" items="${flatforms}" varStatus="xh">
                            <option value="${item.id}">${item.flatform}</option>
                        </c:forEach>
                    </select>
                    <span class="col-4">error</span>
                </div>
            </div>
            <div class="form-group form-row ">
                <label for="categoryLevel1" class="col-3">一级分类:</label>
                <select id="categoryLevel1" name="categoryLevel1" class="form-control col-5">
                    <option selected hidden>请选择</option>
                    <c:forEach var="item" items="${firstLevels}" varStatus="xh">
                        <option value="${item.id}">${item.name}</option>
                    </c:forEach>
                </select>
                <span class="col-4">error</span>
            </div>
            <div class="form-group form-row ">
                <label for="categoryLevel2" class="col-3">二级分类:</label>
                <select id="categoryLevel2" name="categoryLevel2" class="form-control col-5">
                    <option hidden>请选择</option>
                </select>
                <span class="col-4">error</span>
            </div>
            <div class="form-group  form-row ">
                <label for="categoryLevel3" class="col-3">三级分类:</label>
                <select id="categoryLevel3" name="categoryLevel3" class="form-control col-5">
                    <option hidden>请选择</option>
                </select>
                <span class="col-4">error</span>
            </div>
            <div class="form-group  form-row">
                <label for="status" class="col-3">APP状态:</label>
                <input type="text" class="form-control col-5" name="status" id="status" readonly value="待审核">
                <span class="col-4">error</span>
            </div>
            <div class="form-group  form-row">
                <label for="appInfo" class="col-3">应用简介:</label>
                <textarea class="form-control col-5" cols="50" rows="4" name="appInfo" id="appInfo"></textarea>
                <span class="col-4">error</span>
            </div>
            <div class="form-group  form-row">
                <label for="logoPath" class="col-3">LOGO图片:</label>
                <input class="form-control col-5" type="file" name="logoPath" id="logoPath"></input>
                <span class="col-4">error</span>
            </div>
            <button type="submit" class="btn btn-primary" id="save">保存</button>
<%--            <input class="submit" type="button" value="返回" id="back" name="back" href="javascript:history.go(-1)"/>--%>
            <a class="btn btn-primary" href="list/${devId}/1">返回</a>
        </form>
    </div>
</div>
</body>
</html>
